package com.ccp.dev.workflow.model.bpm;

import com.ccp.dev.core.basic.model.BaseModel;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.EqualsBuilder;

import java.util.Date;

/**
 * 对象功能:流程运行日志 Model对象
 */
public class BpmRunLog extends BaseModel {
    /**
     * 操作类型：启动流程
     */
    public static final Integer OPERATOR_TYPE_START = 0;

    /**
     * 操作类型：交办
     */
    public static final Integer OPERATOR_TYPE_DELEGATE = 1;

    /**
     * 操作类型：撤销
     */
    public static final Integer OPERATOR_TYPE_RETRIEVE = 2;

    /**
     * 操作类型：删除流程实例
     */
    public static final Integer OPERATOR_TYPE_DELETEINSTANCE = 3;

    /**
     * 操作类型：投票——同意
     */
    public static final Integer OPERATOR_TYPE_AGREE = 4;

    /**
     * 操作类型：投票——反对
     */
    public static final Integer OPERATOR_TYPE_OBJECTION = 5;

    /**
     * 操作类型：投票——弃权
     */
    public static final Integer OPERATOR_TYPE_ABSTENTION = 6;

    /**
     * 操作类型：补签
     */
    public static final Integer OPERATOR_TYPE_SIGN = 7;

    /**
     * 操作类型：驳回
     */
    public static final Integer OPERATOR_TYPE_REJECT = 8;

    /**
     * 操作类型：驳回到发起人
     */
    public static final Integer OPERATOR_TYPE_REJECT2SPONSOR = 9;

    /**
     * 操作类型：删除任务
     */
    public static final Integer OPERATOR_TYPE_DELETETASK = 10;

    /**
     * 操作类型：执行代理任务
     */
    public static final Integer OPERATOR_TYPE_AGENT = 11;

    /**
     * 操作类型：锁定任务
     */
    public static final Integer OPERATOR_TYPE_LOCK = 13;

    /**
     * 操作类型：任务解锁
     */
    public static final Integer OPERATOR_TYPE_UNLOCK = 14;

    /**
     * 操作类型：添加意见。
     */
    public static final Integer OPERATOR_TYPE_ADDOPINION = 15;

    /**
     * 操作类型：任务指派。
     */
    public static final Integer OPERATOR_TYPE_ASSIGN = 16;

    /**
     * 操作类型：修改任务所有人。
     */
    public static final Integer OPERATOR_TYPE_SETOWNER = 17;

    /**
     * 操作类型：结束任务
     */
    public static final Integer OPERATOR_TYPE_ENDTASK = 18;

    /**
     * 操作类型：更改执行路径
     */
    public static final Integer OPERATOR_TYPE_CHANGEPATH = 19;

    /**
     * 操作类型：收回任务
     */
    public static final Integer OPERATOR_TYPE_BACK = 20;

    /**
     * 操作类型：结束流程实例
     */
    public static final Integer OPERATOR_TYPE_ENDINSTANCE = 21;

    /**
     * 操作类型：保存草稿
     */
    public static final Integer OPERATOR_TYPE_SAVEFORM = 22;

    /**
     * 操作类型：删除流程草稿
     */
    public static final Integer OPERATOR_TYPE_DELETEFORM = 23;

    /**
     * 操作类型：办结转发
     */
    public static final Integer OPERATOR_TYPE_FINISHDIVERT = 24;

    /**
     * 操作类型：撤销
     * 2019-11-06
     * 新增逻辑： 区分【撤销】和【追回】操作类型，老平台中两者在流程操作日志属于同一操作类型（追回不添加日志），现新平台时追加追回的操作日志，故新增25形成区分，便于用户识别
     */
    public static final Integer OPERATOR_TYPE_REDO = 25;

    /**
     * 操作类型：交接
     * 2020-03-09 jyq新增
     */
    public static final Integer OPERATOR_TYPE_HANDOVER = 26;

    // 主键
    protected String id;
    // 用户ID
    protected String userId;
    // 用户名称
    protected String userName;
    // 操作时间
    //protected java.util.Date createTime;
    private Date createTime;
    // 操作类型
    protected Integer operatorType;
    // 备注
    protected String memo;
    //流程运行ID
    protected String runId;
    //流程标题
    protected String processSubject;

    public void setId(String id) {
        this.id = id;
    }

    /**
     * 返回 主键
     *
     * @return
     */
    public String getId() {
        return this.id;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    /**
     * 返回 用户ID
     *
     * @return
     */
    public String getUserId() {
        return this.userId;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    /**
     * 返回 用户名称
     *
     * @return
     */
    public String getUserName() {
        return this.userName;
    }

    @Override
    public void setCreateTime(java.util.Date createTime) {
        this.createTime = createTime;
    }

    /**
     * 返回 操作时间
     *
     * @return
     */
    @Override
    public java.util.Date getCreateTime() {
        return this.createTime;
    }

    public void setOperatorType(Integer operatorType) {
        this.operatorType = operatorType;
    }

    /**
     * 返回 操作类型
     *
     * @return
     */
    public Integer getOperatorType() {
        return this.operatorType;
    }

    public void setMemo(String memo) {
        this.memo = memo;
    }

    /**
     * 返回 备注
     *
     * @return
     */
    public String getMemo() {
        return this.memo;
    }


    public String getRunId() {
        return runId;
    }

    public void setRunId(String runId) {
        this.runId = runId;
    }

    @Override
    public boolean equals(Object object) {
        if (!(object instanceof BpmRunLog)) {
            return false;
        }
        BpmRunLog rhs = (BpmRunLog) object;
        return new EqualsBuilder()
                .append(this.id, rhs.id)
                .append(this.userId, rhs.userId)
                .append(this.userName, rhs.userName)
                .append(this.createTime, rhs.createTime)
                .append(this.operatorType, rhs.operatorType)
                .append(this.memo, rhs.memo)
                .append(this.runId, rhs.runId)
                .append(this.processSubject, rhs.processSubject)
                .isEquals();
    }

    /**
     * @see Object#hashCode()
     */
    @Override
    public int hashCode() {
        return new HashCodeBuilder(-82280557, -700257973)
                .append(this.id)
                .append(this.userId)
                .append(this.userName)
                .append(this.createTime)
                .append(this.operatorType)
                .append(this.memo)
                .append(this.runId)
                .append(this.processSubject)
                .toHashCode();
    }

    /**
     * @see Object#toString()
     */
    @Override
    public String toString() {
        return new ToStringBuilder(this)
                .append("id", this.id)
                .append("userId", this.userId)
                .append("userName", this.userName)
                .append("createTime", this.createTime)
                .append("operatorType", this.operatorType)
                .append("memo", this.memo)
                .append("runId", this.runId)
                .append("processSubject", this.processSubject)
                .toString();
    }

    public String getProcessSubject() {
        return processSubject;
    }

    public void setProcessSubject(String processSubject) {
        this.processSubject = processSubject;
    }


}